<?php

namespace app\models\jasper;

use yii\base\NotSupportedException;

trait JasperApiOrderTrait
{
    /**
     * @param integer $orderId
     * @param string $orderStatus
     * @param string $statusUpdateNote
     * @param string $shippingTrackingNumber
     * @return \stdClass
     * @throws \Exception
     */
    public function UpdateOrderStatus($orderId, $orderStatus, $statusUpdateNote, $shippingTrackingNumber)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'orderId' => $orderId,
                'orderStatus' => $orderStatus,
                'statusUpdateNote' => $statusUpdateNote,
                'shippingTrackingNumber' => $shippingTrackingNumber
            ]
        );
    }

    /**
     * @throws NotSupportedException
     */
    public function AdvanceShipmentNotification()
    {
        throw new NotSupportedException();
    }

    /**
     * @param integer $orderId
     * @return \stdClass
     * @throws \Exception
     */
    public function GetBulkUpdateStatus($orderId)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'orderId' => $orderId,
            ]
        );
    }
}
